<html>
<head><meta charset="utf-8"><title>Errors below docs · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html">Errors below docs</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="218672178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218672178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218672178">(Dec 03 2020 at 09:53)</a>:</h4>
<p>Should we stop returning the documentation on hover when there's a diagnostic that contains the symbol? It seems a bit heavy-handed, but it's quite annoying right now.</p>



<a name="218820869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218820869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218820869">(Dec 04 2020 at 11:26)</a>:</h4>
<p>Probably? I don't use hover, so I don't have an opinion here :D</p>



<a name="218821020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218821020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218821020">(Dec 04 2020 at 11:28)</a>:</h4>
<p>I'm not sure what the other language servers do</p>



<a name="218821097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218821097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218821097">(Dec 04 2020 at 11:29)</a>:</h4>
<p><a href="/user_uploads/4715/0HOrtuvV8pYn8x9GLV4HKLDO/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/0HOrtuvV8pYn8x9GLV4HKLDO/image.png" title="image.png"><img src="/user_uploads/4715/0HOrtuvV8pYn8x9GLV4HKLDO/image.png"></a></div>



<a name="218821107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218821107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218821107">(Dec 04 2020 at 11:29)</a>:</h4>
<p>I figured it out, the problem is that Rust docstrings are too long <span aria-label="smiley" class="emoji emoji-1f603" role="img" title="smiley">:smiley:</span></p>



<a name="218821209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218821209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218821209">(Dec 04 2020 at 11:30)</a>:</h4>
<p>I've noticed that sometimes docs of the whole crate (every item) are displayed instead of just the thing I hover over</p>



<a name="218829066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218829066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218829066">(Dec 04 2020 at 13:00)</a>:</h4>
<p>Example: <a href="/user_uploads/4715/yU-o5PAzRpUqHead05WCENvG/screenshot-2020-12-04-135937.png">screenshot-2020-12-04-135937.png</a> </p>
<div class="message_inline_image"><a href="/user_uploads/4715/yU-o5PAzRpUqHead05WCENvG/screenshot-2020-12-04-135937.png" title="screenshot-2020-12-04-135937.png"><img src="/user_uploads/4715/yU-o5PAzRpUqHead05WCENvG/screenshot-2020-12-04-135937.png"></a></div><p>This is displaying much more than just the crate-level docs here: <a href="https://docs.rs/defmt/0.1.3/defmt/">https://docs.rs/defmt/0.1.3/defmt/</a></p>



<a name="218832496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218832496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218832496">(Dec 04 2020 at 13:32)</a>:</h4>
<p>yikes</p>



<a name="218836163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218836163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218836163">(Dec 04 2020 at 14:05)</a>:</h4>
<p>I think the problem here is that <code>Use</code> items don't have docs in the syntax representation, that is they aren't <code>DocCommentsOwner</code>. So I believe <code>SourceFile</code>s just get all the docs of those as well which causes this.</p>



<a name="218836276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218836276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218836276">(Dec 04 2020 at 14:06)</a>:</h4>
<p>I'm not 100% sure this is how this happens as I haven't checked how the parser works, but I can confirm that it's the documented use items that cause this.</p>



<a name="218836823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218836823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218836823">(Dec 04 2020 at 14:11)</a>:</h4>
<p>Not sure how to implement it, but the correct behavior is to combine the new docs with the original docs, like rustdoc does</p>



<a name="218836842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218836842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218836842">(Dec 04 2020 at 14:12)</a>:</h4>
<p>And then to show the item being re-exported, not the <code>use</code> itself</p>



<a name="218836984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218836984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218836984">(Dec 04 2020 at 14:12)</a>:</h4>
<p>What happens if you put doc comments on <code>use thing::{A, B};</code>? Do they get combined with both <code>A</code> and <code>B</code>'s docs?</p>



<a name="218837039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218837039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218837039">(Dec 04 2020 at 14:13)</a>:</h4>
<p>Uhhh good question</p>



<a name="218837044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218837044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218837044">(Dec 04 2020 at 14:13)</a>:</h4>
<p>And does it work with glob reexports?</p>



<a name="218837070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218837070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218837070">(Dec 04 2020 at 14:13)</a>:</h4>
<p>I think rustdoc might ignore anything that's not a single import?</p>



<a name="218837175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218837175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218837175">(Dec 04 2020 at 14:14)</a>:</h4>
<p>I know for sure globs get discarded early</p>



<a name="218837424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218837424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218837424">(Dec 04 2020 at 14:16)</a>:</h4>
<p>oh interesting globs are <em>not</em> ignored <a href="https://github.com/rust-lang/rust/blob/master/src/librustdoc/clean/inline.rs#L132">https://github.com/rust-lang/rust/blob/master/src/librustdoc/clean/inline.rs#L132</a></p>



<a name="218837523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218837523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218837523">(Dec 04 2020 at 14:17)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/src/librustdoc/visit_ast.rs#L251">https://github.com/rust-lang/rust/blob/master/src/librustdoc/visit_ast.rs#L251</a> is also relevant</p>



<a name="218837533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218837533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218837533">(Dec 04 2020 at 14:17)</a>:</h4>
<p>but I'd have to read the code to tell you any more</p>



<a name="218842253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218842253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218842253">(Dec 04 2020 at 14:54)</a>:</h4>
<p>Just checked, the parser doesn't attach the trivia tokens to <code>Use</code> items so the parent just inherits them as they lie inside of the parent. <a href="https://github.com/rust-analyzer/rust-analyzer/pull/6719">https://github.com/rust-analyzer/rust-analyzer/pull/6719</a></p>



<a name="218843071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Errors%20below%20docs/near/218843071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Errors.20below.20docs.html#218843071">(Dec 04 2020 at 15:00)</a>:</h4>
<p>Hmm this change doesn't play nice with folding</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>